package com.fhz.day003.mvvm;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;

/**
 * 时间:2022/3/22
 *
 * @author msfeng
 * 简述: TODO
 */
public abstract class BaseMVVMActivity<VM extends BaseViewModel,DB extends ViewDataBinding> extends AppCompatActivity {

    protected VM mViewModel;
    protected DB binding;

    protected abstract void init();
    protected abstract VM createViewModel();
    protected abstract int getLayoutId();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mViewModel = createViewModel();
        binding = DataBindingUtil.setContentView(this,getLayoutId());
        init();
    }
}

